package cn.edu.hubu.hubusmartmedicalsystem.controller;

import cn.edu.hubu.hubusmartmedicalsystem.entity.Report;
import cn.edu.hubu.hubusmartmedicalsystem.service.ReportService;
import cn.edu.hubu.hubusmartmedicalsystem.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
public class ReportController {

    @Autowired
    private ReportService reportService;

    // 根据报告 ID 查询报告
    @RequestMapping("/report/get")
    public ResultVO getReportById(String reportId) {
        return reportService.getReportById(reportId);
    }

    // 查询所有报告
    @RequestMapping("/report/getAll")
    public ResultVO getAllReports() {
        return reportService.getAllReports();
    }

    // 添加单个报告
    @RequestMapping("/report/add")
    public ResultVO addReport(Report report) {
        return reportService.addReport(report);
    }

    // 更新报告
    @RequestMapping("/report/update")
    public ResultVO updateReport(Report report) {
        return reportService.updateReport(report);
    }

    // 删除报告通过 ID
    @RequestMapping("/report/delete")
    public ResultVO deleteReport(String reportId) {
        return reportService.deleteReport(reportId);
    }

    // 批量添加报告
    @RequestMapping("/report/addBatch")
    public ResultVO addReports(@RequestBody List<Report> reports) {
        return reportService.addReports(reports);
    }

    // 批量删除报告
    @RequestMapping("/report/deleteBatch")
    public ResultVO deleteReports(@RequestBody List<String> reportIds) {
        return reportService.deleteReports(reportIds);
    }
}
